
public class HHsa {
	
	public static void main(String[] args) {
	  Geometric g=new Triangle(3,4,5);
	  System.out.println(g.getArea());
	  System.out.println(g.getPerimeter());
	  
	 g=new Rectangle(2,3);
	  System.out.println(g.getArea());
	  System.out.println(g.getPerimeter());
	 g=new Circle(1);
	 System.out.println(g.getArea());
	  System.out.println(g.getPerimeter());
	  
	}
}

abstract class  Geometric{
	int d=2;
	 public abstract double getArea();
	 
	 public abstract double getPerimeter();
 
 }

class Triangle extends Geometric{
	int a;
	int b;
	int c;
	public Triangle(int a,int b,int c){
		this.a=a;
		this.b=b;
		this.c=c;
	}
	public  double getArea(){
		double s=0.25*Math.sqrt((a+b+c)*(a+b-c)*(a-b+c)*(b+c-a));
		return s+d;
	}
	public double getPerimeter(){
		
		return a+b+c;
	}
	
}

class Rectangle extends Geometric{
	int a;
	int b;
	public Rectangle(int a,int b){
		this.a=a;
		this.b=b;
	}
	
	public  double getArea(){
		return a*b;
	}
	public double getPerimeter(){
		return 2*(a+b);
	}
	
}

class Circle extends Geometric{
	int r;
	public Circle(int r){
		this.r=r;
	}
	
	public  double getArea(){
		return 2*Math.PI*r;
	}
	public double getPerimeter(){
		return Math.PI*r*r;
	}
}